home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / MAK3791B.ZIP / info / make.i8 < prev    next >
Encoding:
GNU Info File  |  2000-07-14  |  41.0 KB  |  1,059 lines

  1. This is make.info, produced by makeinfo version 4.0 from make.texinfo.
  2.  
  3. INFO-DIR-SECTION GNU Packages
  4. START-INFO-DIR-ENTRY
  5. * Make: (make).            Remake files automatically.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the GNU Make utility, which determines
  9. automatically which pieces of a large program need to be recompiled,
  10. and issues the commands to recompile them.
  11.  
  12.    This is Edition 0.55, last updated 04 April 2000, of `The GNU Make
  13. Manual', for `make', Version 3.79.
  14.  
  15.    Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95, '96, '97,
  16. '98, '99, 2000         Free Software Foundation, Inc.
  17.  
  18.    Permission is granted to make and distribute verbatim copies of this
  19. manual provided the copyright notice and this permission notice are
  20. preserved on all copies.
  21.  
  22.    Permission is granted to copy and distribute modified versions of
  23. this manual under the conditions for verbatim copying, provided that
  24. the entire resulting derived work is distributed under the terms of a
  25. permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that this permission notice may be stated in a
  30. translation approved by the Free Software Foundation.
  31.  
  32. 
  33. File: make.info,  Node: Standard Targets,  Next: Install Command Categories,  Prev: Directory Variables,  Up: Makefile Conventions
  34.  
  35. Standard Targets for Users
  36. ==========================
  37.  
  38.    All GNU programs should have the following targets in their
  39. Makefiles:
  40.  
  41. `all'
  42.      Compile the entire program.  This should be the default target.
  43.      This target need not rebuild any documentation files; Info files
  44.      should normally be included in the distribution, and DVI files
  45.      should be made only when explicitly asked for.
  46.  
  47.      By default, the Make rules should compile and link with `-g', so
  48.      that executable programs have debugging symbols.  Users who don't
  49.      mind being helpless can strip the executables later if they wish.
  50.  
  51. `install'
  52.      Compile the program and copy the executables, libraries, and so on
  53.      to the file names where they should reside for actual use.  If
  54.      there is a simple test to verify that a program is properly
  55.      installed, this target should run that test.
  56.  
  57.      Do not strip executables when installing them.  Devil-may-care
  58.      users can use the `install-strip' target to do that.
  59.  
  60.      If possible, write the `install' target rule so that it does not
  61.      modify anything in the directory where the program was built,
  62.      provided `make all' has just been done.  This is convenient for
  63.      building the program under one user name and installing it under
  64.      another.
  65.  
  66.      The commands should create all the directories in which files are
  67.      to be installed, if they don't already exist.  This includes the
  68.      directories specified as the values of the variables `prefix' and
  69.      `exec_prefix', as well as all subdirectories that are needed.  One
  70.      way to do this is by means of an `installdirs' target as described
  71.      below.
  72.  
  73.      Use `-' before any command for installing a man page, so that
  74.      `make' will ignore any errors.  This is in case there are systems
  75.      that don't have the Unix man page documentation system installed.
  76.  
  77.      The way to install Info files is to copy them into `$(infodir)'
  78.      with `$(INSTALL_DATA)' (*note Command Variables::), and then run
  79.      the `install-info' program if it is present.  `install-info' is a
  80.      program that edits the Info `dir' file to add or update the menu
  81.      entry for the given Info file; it is part of the Texinfo package.
  82.      Here is a sample rule to install an Info file:
  83.  
  84.           $(DESTDIR)$(infodir)/foo.info: foo.info
  85.                   $(POST_INSTALL)
  86.           # There may be a newer info file in . than in srcdir.
  87.                   -if test -f foo.info; then d=.; \
  88.                    else d=$(srcdir); fi; \
  89.                   $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@; \
  90.           # Run install-info only if it exists.
  91.           # Use `if' instead of just prepending `-' to the
  92.           # line so we notice real errors from install-info.
  93.           # We use `$(SHELL) -c' because some shells do not
  94.           # fail gracefully when there is an unknown command.
  95.                   if $(SHELL) -c 'install-info --version' \
  96.                      >/dev/null 2>&1; then \
  97.                     install-info --dir-file=$(DESTDIR)$(infodir)/dir \
  98.                                  $(DESTDIR)$(infodir)/foo.info; \
  99.                   else true; fi
  100.  
  101.      When writing the `install' target, you must classify all the
  102.      commands into three categories: normal ones, "pre-installation"
  103.      commands and "post-installation" commands.  *Note Install Command
  104.      Categories::.
  105.  
  106. `uninstall'
  107.      Delete all the installed files--the copies that the `install'
  108.      target creates.
  109.  
  110.      This rule should not modify the directories where compilation is
  111.      done, only the directories where files are installed.
  112.  
  113.      The uninstallation commands are divided into three categories,
  114.      just like the installation commands.  *Note Install Command
  115.      Categories::.
  116.  
  117. `install-strip'
  118.      Like `install', but strip the executable files while installing
  119.      them.  In many cases, the definition of this target can be very
  120.      simple:
  121.  
  122.           install-strip:
  123.                   $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
  124.                           install
  125.  
  126.      Normally we do not recommend stripping an executable unless you
  127.      are sure the program has no bugs.  However, it can be reasonable
  128.      to install a stripped executable for actual execution while saving
  129.      the unstripped executable elsewhere in case there is a bug.
  130.  
  131. `clean'
  132.      Delete all files from the current directory that are normally
  133.      created by building the program.  Don't delete the files that
  134.      record the configuration.  Also preserve files that could be made
  135.      by building, but normally aren't because the distribution comes
  136.      with them.
  137.  
  138.      Delete `.dvi' files here if they are not part of the distribution.
  139.  
  140. `distclean'
  141.      Delete all files from the current directory that are created by
  142.      configuring or building the program.  If you have unpacked the
  143.      source and built the program without creating any other files,
  144.      `make distclean' should leave only the files that were in the
  145.      distribution.
  146.  
  147. `mostlyclean'
  148.      Like `clean', but may refrain from deleting a few files that people
  149.      normally don't want to recompile.  For example, the `mostlyclean'
  150.      target for GCC does not delete `libgcc.a', because recompiling it
  151.      is rarely necessary and takes a lot of time.
  152.  
  153. `maintainer-clean'
  154.      Delete almost everything from the current directory that can be
  155.      reconstructed with this Makefile.  This typically includes
  156.      everything deleted by `distclean', plus more: C source files
  157.      produced by Bison, tags tables, Info files, and so on.
  158.  
  159.      The reason we say "almost everything" is that running the command
  160.      `make maintainer-clean' should not delete `configure' even if
  161.      `configure' can be remade using a rule in the Makefile.  More
  162.      generally, `make maintainer-clean' should not delete anything that
  163.      needs to exist in order to run `configure' and then begin to build
  164.      the program.  This is the only exception; `maintainer-clean' should
  165.      delete everything else that can be rebuilt.
  166.  
  167.      The `maintainer-clean' target is intended to be used by a
  168.      maintainer of the package, not by ordinary users.  You may need
  169.      special tools to reconstruct some of the files that `make
  170.      maintainer-clean' deletes.  Since these files are normally
  171.      included in the distribution, we don't take care to make them easy
  172.      to reconstruct.  If you find you need to unpack the full
  173.      distribution again, don't blame us.
  174.  
  175.      To help make users aware of this, the commands for the special
  176.      `maintainer-clean' target should start with these two:
  177.  
  178.           @echo 'This command is intended for maintainers to use; it'
  179.           @echo 'deletes files that may need special tools to rebuild.'
  180.  
  181. `TAGS'
  182.      Update a tags table for this program.
  183.  
  184. `info'
  185.      Generate any Info files needed.  The best way to write the rules
  186.      is as follows:
  187.  
  188.           info: foo.info
  189.           
  190.           foo.info: foo.texi chap1.texi chap2.texi
  191.                   $(MAKEINFO) $(srcdir)/foo.texi
  192.  
  193.      You must define the variable `MAKEINFO' in the Makefile.  It should
  194.      run the `makeinfo' program, which is part of the Texinfo
  195.      distribution.
  196.  
  197.      Normally a GNU distribution comes with Info files, and that means
  198.      the Info files are present in the source directory.  Therefore,
  199.      the Make rule for an info file should update it in the source
  200.      directory.  When users build the package, ordinarily Make will not
  201.      update the Info files because they will already be up to date.
  202.  
  203. `dvi'
  204.      Generate DVI files for all Texinfo documentation.  For example:
  205.  
  206.           dvi: foo.dvi
  207.           
  208.           foo.dvi: foo.texi chap1.texi chap2.texi
  209.                   $(TEXI2DVI) $(srcdir)/foo.texi
  210.  
  211.      You must define the variable `TEXI2DVI' in the Makefile.  It should
  212.      run the program `texi2dvi', which is part of the Texinfo
  213.      distribution.(1)  Alternatively, write just the dependencies, and
  214.      allow GNU `make' to provide the command.
  215.  
  216. `dist'
  217.      Create a distribution tar file for this program.  The tar file
  218.      should be set up so that the file names in the tar file start with
  219.      a subdirectory name which is the name of the package it is a
  220.      distribution for.  This name can include the version number.
  221.  
  222.      For example, the distribution tar file of GCC version 1.40 unpacks
  223.      into a subdirectory named `gcc-1.40'.
  224.  
  225.      The easiest way to do this is to create a subdirectory
  226.      appropriately named, use `ln' or `cp' to install the proper files
  227.      in it, and then `tar' that subdirectory.
  228.  
  229.      Compress the tar file file with `gzip'.  For example, the actual
  230.      distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'.
  231.  
  232.      The `dist' target should explicitly depend on all non-source files
  233.      that are in the distribution, to make sure they are up to date in
  234.      the distribution.  *Note Making Releases: (standards)Releases.
  235.  
  236. `check'
  237.      Perform self-tests (if any).  The user must build the program
  238.      before running the tests, but need not install the program; you
  239.      should write the self-tests so that they work when the program is
  240.      built but not installed.
  241.  
  242.    The following targets are suggested as conventional names, for
  243. programs in which they are useful.
  244.  
  245. `installcheck'
  246.      Perform installation tests (if any).  The user must build and
  247.      install the program before running the tests.  You should not
  248.      assume that `$(bindir)' is in the search path.
  249.  
  250. `installdirs'
  251.      It's useful to add a target named `installdirs' to create the
  252.      directories where files are installed, and their parent
  253.      directories.  There is a script called `mkinstalldirs' which is
  254.      convenient for this; you can find it in the Texinfo package.  You
  255.      can use a rule like this:
  256.  
  257.           # Make sure all installation directories (e.g. $(bindir))
  258.           # actually exist by making them if necessary.
  259.           installdirs: mkinstalldirs
  260.                   $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
  261.                                           $(libdir) $(infodir) \
  262.                                           $(mandir)
  263.  
  264.      This rule should not modify the directories where compilation is
  265.      done.  It should do nothing but create installation directories.
  266.  
  267.    ---------- Footnotes ----------
  268.  
  269.    (1) `texi2dvi' uses TeX to do the real work of formatting. TeX is
  270. not distributed with Texinfo.
  271.  
  272. 
  273. File: make.info,  Node: Install Command Categories,  Prev: Standard Targets,  Up: Makefile Conventions
  274.  
  275. Install Command Categories
  276. ==========================
  277.  
  278.    When writing the `install' target, you must classify all the
  279. commands into three categories: normal ones, "pre-installation"
  280. commands and "post-installation" commands.
  281.  
  282.    Normal commands move files into their proper places, and set their
  283. modes.  They may not alter any files except the ones that come entirely
  284. from the package they belong to.
  285.  
  286.    Pre-installation and post-installation commands may alter other
  287. files; in particular, they can edit global configuration files or data
  288. bases.
  289.  
  290.    Pre-installation commands are typically executed before the normal
  291. commands, and post-installation commands are typically run after the
  292. normal commands.
  293.  
  294.    The most common use for a post-installation command is to run
  295. `install-info'.  This cannot be done with a normal command, since it
  296. alters a file (the Info directory) which does not come entirely and
  297. solely from the package being installed.  It is a post-installation
  298. command because it needs to be done after the normal command which
  299. installs the package's Info files.
  300.  
  301.    Most programs don't need any pre-installation commands, but we have
  302. the feature just in case it is needed.
  303.  
  304.    To classify the commands in the `install' rule into these three
  305. categories, insert "category lines" among them.  A category line
  306. specifies the category for the commands that follow.
  307.  
  308.    A category line consists of a tab and a reference to a special Make
  309. variable, plus an optional comment at the end.  There are three
  310. variables you can use, one for each category; the variable name
  311. specifies the category.  Category lines are no-ops in ordinary execution
  312. because these three Make variables are normally undefined (and you
  313. _should not_ define them in the makefile).
  314.  
  315.    Here are the three possible category lines, each with a comment that
  316. explains what it means:
  317.  
  318.              $(PRE_INSTALL)     # Pre-install commands follow.
  319.              $(POST_INSTALL)    # Post-install commands follow.
  320.              $(NORMAL_INSTALL)  # Normal commands follow.
  321.  
  322.    If you don't use a category line at the beginning of the `install'
  323. rule, all the commands are classified as normal until the first category
  324. line.  If you don't use any category lines, all the commands are
  325. classified as normal.
  326.  
  327.    These are the category lines for `uninstall':
  328.  
  329.              $(PRE_UNINSTALL)     # Pre-uninstall commands follow.
  330.              $(POST_UNINSTALL)    # Post-uninstall commands follow.
  331.              $(NORMAL_UNINSTALL)  # Normal commands follow.
  332.  
  333.    Typically, a pre-uninstall command would be used for deleting entries
  334. from the Info directory.
  335.  
  336.    If the `install' or `uninstall' target has any dependencies which
  337. act as subroutines of installation, then you should start _each_
  338. dependency's commands with a category line, and start the main target's
  339. commands with a category line also.  This way, you can ensure that each
  340. command is placed in the right category regardless of which of the
  341. dependencies actually run.
  342.  
  343.    Pre-installation and post-installation commands should not run any
  344. programs except for these:
  345.  
  346.      [ basename bash cat chgrp chmod chown cmp cp dd diff echo
  347.      egrep expand expr false fgrep find getopt grep gunzip gzip
  348.      hostname install install-info kill ldconfig ln ls md5sum
  349.      mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
  350.      test touch true uname xargs yes
  351.  
  352.    The reason for distinguishing the commands in this way is for the
  353. sake of making binary packages.  Typically a binary package contains
  354. all the executables and other files that need to be installed, and has
  355. its own method of installing them--so it does not need to run the normal
  356. installation commands.  But installing the binary package does need to
  357. execute the pre-installation and post-installation commands.
  358.  
  359.    Programs to build binary packages work by extracting the
  360. pre-installation and post-installation commands.  Here is one way of
  361. extracting the pre-installation commands:
  362.  
  363.      make -n install -o all \
  364.            PRE_INSTALL=pre-install \
  365.            POST_INSTALL=post-install \
  366.            NORMAL_INSTALL=normal-install \
  367.        | gawk -f pre-install.awk
  368.  
  369. where the file `pre-install.awk' could contain this:
  370.  
  371.      $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0}
  372.      on {print $0}
  373.      $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1}
  374.  
  375.    The resulting file of pre-installation commands is executed as a
  376. shell script as part of installing the binary package.
  377.  
  378. 
  379. File: make.info,  Node: Quick Reference,  Next: Error Messages,  Prev: Makefile Conventions,  Up: Top
  380.  
  381. Quick Reference
  382. ***************
  383.  
  384.    This appendix summarizes the directives, text manipulation functions,
  385. and special variables which GNU `make' understands.  *Note Special
  386. Targets::, *Note Catalogue of Implicit Rules: Catalogue of Rules, and
  387. *Note Summary of Options: Options Summary, for other summaries.
  388.  
  389.    Here is a summary of the directives GNU `make' recognizes:
  390.  
  391. `define VARIABLE'
  392. `endef'
  393.      Define a multi-line, recursively-expanded variable.
  394.      *Note Sequences::.
  395.  
  396. `ifdef VARIABLE'
  397. `ifndef VARIABLE'
  398. `ifeq (A,B)'
  399. `ifeq "A" "B"'
  400. `ifeq 'A' 'B''
  401. `ifneq (A,B)'
  402. `ifneq "A" "B"'
  403. `ifneq 'A' 'B''
  404. `else'
  405. `endif'
  406.      Conditionally evaluate part of the makefile.
  407.      *Note Conditionals::.
  408.  
  409. `include FILE'
  410. `-include FILE'
  411. `sinclude FILE'
  412.      Include another makefile.
  413.      *Note Including Other Makefiles: Include.
  414.  
  415. `override VARIABLE = VALUE'
  416. `override VARIABLE := VALUE'
  417. `override VARIABLE += VALUE'
  418. `override VARIABLE ?= VALUE'
  419. `override define VARIABLE'
  420. `endef'
  421.      Define a variable, overriding any previous definition, even one
  422.      from the command line.
  423.      *Note The `override' Directive: Override Directive.
  424.  
  425. `export'
  426.      Tell `make' to export all variables to child processes by default.
  427.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  428.  
  429. `export VARIABLE'
  430. `export VARIABLE = VALUE'
  431. `export VARIABLE := VALUE'
  432. `export VARIABLE += VALUE'
  433. `export VARIABLE ?= VALUE'
  434. `unexport VARIABLE'
  435.      Tell `make' whether or not to export a particular variable to child
  436.      processes.
  437.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  438.  
  439. `vpath PATTERN PATH'
  440.      Specify a search path for files matching a `%' pattern.
  441.      *Note The `vpath' Directive: Selective Search.
  442.  
  443. `vpath PATTERN'
  444.      Remove all search paths previously specified for PATTERN.
  445.  
  446. `vpath'
  447.      Remove all search paths previously specified in any `vpath'
  448.      directive.
  449.  
  450.    Here is a summary of the text manipulation functions (*note
  451. Functions::):
  452.  
  453. `$(subst FROM,TO,TEXT)'
  454.      Replace FROM with TO in TEXT.
  455.      *Note Functions for String Substitution and Analysis: Text
  456.      Functions.
  457.  
  458. `$(patsubst PATTERN,REPLACEMENT,TEXT)'
  459.      Replace words matching PATTERN with REPLACEMENT in TEXT.
  460.      *Note Functions for String Substitution and Analysis: Text
  461.      Functions.
  462.  
  463. `$(strip STRING)'
  464.      Remove excess whitespace characters from STRING.
  465.      *Note Functions for String Substitution and Analysis: Text
  466.      Functions.
  467.  
  468. `$(findstring FIND,TEXT)'
  469.      Locate FIND in TEXT.
  470.      *Note Functions for String Substitution and Analysis: Text
  471.      Functions.
  472.  
  473. `$(filter PATTERN...,TEXT)'
  474.      Select words in TEXT that match one of the PATTERN words.
  475.      *Note Functions for String Substitution and Analysis: Text
  476.      Functions.
  477.  
  478. `$(filter-out PATTERN...,TEXT)'
  479.      Select words in TEXT that _do not_ match any of the PATTERN words.
  480.      *Note Functions for String Substitution and Analysis: Text
  481.      Functions.
  482.  
  483. `$(sort LIST)'
  484.      Sort the words in LIST lexicographically, removing duplicates.
  485.      *Note Functions for String Substitution and Analysis: Text
  486.      Functions.
  487.  
  488. `$(dir NAMES...)'
  489.      Extract the directory part of each file name.
  490.      *Note Functions for File Names: File Name Functions.
  491.  
  492. `$(notdir NAMES...)'
  493.      Extract the non-directory part of each file name.
  494.      *Note Functions for File Names: File Name Functions.
  495.  
  496. `$(suffix NAMES...)'
  497.      Extract the suffix (the last `.' and following characters) of each
  498.      file name.
  499.      *Note Functions for File Names: File Name Functions.
  500.  
  501. `$(basename NAMES...)'
  502.      Extract the base name (name without suffix) of each file name.
  503.      *Note Functions for File Names: File Name Functions.
  504.  
  505. `$(addsuffix SUFFIX,NAMES...)'
  506.      Append SUFFIX to each word in NAMES.
  507.      *Note Functions for File Names: File Name Functions.
  508.  
  509. `$(addprefix PREFIX,NAMES...)'
  510.      Prepend PREFIX to each word in NAMES.
  511.      *Note Functions for File Names: File Name Functions.
  512.  
  513. `$(join LIST1,LIST2)'
  514.      Join two parallel lists of words.
  515.      *Note Functions for File Names: File Name Functions.
  516.  
  517. `$(word N,TEXT)'
  518.      Extract the Nth word (one-origin) of TEXT.
  519.      *Note Functions for File Names: File Name Functions.
  520.  
  521. `$(words TEXT)'
  522.      Count the number of words in TEXT.
  523.      *Note Functions for File Names: File Name Functions.
  524.  
  525. `$(wordlist S,E,TEXT)'
  526.      Returns the list of words in TEXT from S to E.
  527.      *Note Functions for File Names: File Name Functions.
  528.  
  529. `$(firstword NAMES...)'
  530.      Extract the first word of NAMES.
  531.      *Note Functions for File Names: File Name Functions.
  532.  
  533. `$(wildcard PATTERN...)'
  534.      Find file names matching a shell file name pattern (_not_ a `%'
  535.      pattern).
  536.      *Note The Function `wildcard': Wildcard Function.
  537.  
  538. `$(error TEXT...)'
  539.      When this function is evaluated, `make' generates a fatal error
  540.      with the message TEXT.
  541.      *Note Functions That Control Make: Make Control Functions.
  542.  
  543. `$(warning TEXT...)'
  544.      When this function is evaluated, `make' generates a warning with
  545.      the message TEXT.
  546.      *Note Functions That Control Make: Make Control Functions.
  547.  
  548. `$(shell COMMAND)'
  549.      Execute a shell command and return its output.
  550.      *Note The `shell' Function: Shell Function.
  551.  
  552. `$(origin VARIABLE)'
  553.      Return a string describing how the `make' variable VARIABLE was
  554.      defined.
  555.      *Note The `origin' Function: Origin Function.
  556.  
  557. `$(foreach VAR,WORDS,TEXT)'
  558.      Evaluate TEXT with VAR bound to each word in WORDS, and
  559.      concatenate the results.
  560.      *Note The `foreach' Function: Foreach Function.
  561.  
  562. `$(call VAR,PARAM,...)'
  563.      Evaluate the variable VAR replacing any references to `$(1)',
  564.      `$(2)' with the first, second, etc. PARAM values.
  565.      *Note The `call' Function: Call Function.
  566.  
  567.    Here is a summary of the automatic variables.  *Note Automatic
  568. Variables: Automatic, for full information.
  569.  
  570. `$@'
  571.      The file name of the target.
  572.  
  573. `$%'
  574.      The target member name, when the target is an archive member.
  575.  
  576. `$<'
  577.      The name of the first prerequisite.
  578.  
  579. `$?'
  580.      The names of all the prerequisites that are newer than the target,
  581.      with spaces between them.  For prerequisites which are archive
  582.      members, only the member named is used (*note Archives::).
  583.  
  584. `$^'
  585. `$+'
  586.      The names of all the prerequisites, with spaces between them.  For
  587.      prerequisites which are archive members, only the member named is
  588.      used (*note Archives::).  The value of `$^' omits duplicate
  589.      prerequisites, while `$+' retains them and preserves their order.
  590.  
  591. `$*'
  592.      The stem with which an implicit rule matches (*note How Patterns
  593.      Match: Pattern Match.).
  594.  
  595. `$(@D)'
  596. `$(@F)'
  597.      The directory part and the file-within-directory part of `$@'.
  598.  
  599. `$(*D)'
  600. `$(*F)'
  601.      The directory part and the file-within-directory part of `$*'.
  602.  
  603. `$(%D)'
  604. `$(%F)'
  605.      The directory part and the file-within-directory part of `$%'.
  606.  
  607. `$(<D)'
  608. `$(<F)'
  609.      The directory part and the file-within-directory part of `$<'.
  610.  
  611. `$(^D)'
  612. `$(^F)'
  613.      The directory part and the file-within-directory part of `$^'.
  614.  
  615. `$(+D)'
  616. `$(+F)'
  617.      The directory part and the file-within-directory part of `$+'.
  618.  
  619. `$(?D)'
  620. `$(?F)'
  621.      The directory part and the file-within-directory part of `$?'.
  622.  
  623.    These variables are used specially by GNU `make':
  624.  
  625. `MAKEFILES'
  626.      Makefiles to be read on every invocation of `make'.
  627.      *Note The Variable `MAKEFILES': MAKEFILES Variable.
  628.  
  629. `VPATH'
  630.      Directory search path for files not found in the current directory.
  631.      *Note `VPATH' Search Path for All Prerequisites: General Search.
  632.  
  633. `SHELL'
  634.      The name of the system default command interpreter, usually
  635.      `/bin/sh'.  You can set `SHELL' in the makefile to change the
  636.      shell used to run commands.  *Note Command Execution: Execution.
  637.  
  638. `MAKESHELL'
  639.      On MS-DOS only, the name of the command interpreter that is to be
  640.      used by `make'. This value takes precedence over the value of
  641.      `SHELL'.  *Note MAKESHELL variable: Execution.
  642.  
  643. `MAKE'
  644.      The name with which `make' was invoked.  Using this variable in
  645.      commands has special meaning.  *Note How the `MAKE' Variable
  646.      Works: MAKE Variable.
  647.  
  648. `MAKELEVEL'
  649.      The number of levels of recursion (sub-`make's).
  650.      *Note Variables/Recursion::.
  651.  
  652. `MAKEFLAGS'
  653.      The flags given to `make'.  You can set this in the environment or
  654.      a makefile to set flags.
  655.      *Note Communicating Options to a Sub-`make': Options/Recursion.
  656.  
  657.      It is _never_ appropriate to use `MAKEFLAGS' directly on a command
  658.      line: its contents may not be quoted correctly for use in the
  659.      shell.  Always allow recursive `make''s to obtain these values
  660.      through the environment from its parent.
  661.  
  662. `MAKECMDGOALS'
  663.      The targets given to `make' on the command line.  Setting this
  664.      variable has no effect on the operation of `make'.
  665.      *Note Arguments to Specify the Goals: Goals.
  666.  
  667. `CURDIR'
  668.      Set to the pathname of the current working directory (after all
  669.      `-C' options are processed, if any).  Setting this variable has no
  670.      effect on the operation of `make'.
  671.      *Note Recursive Use of `make': Recursion.
  672.  
  673. `SUFFIXES'
  674.      The default list of suffixes before `make' reads any makefiles.
  675.  
  676. `.LIBPATTERNS'
  677.      Defines the naming of the libraries `make' searches for, and their
  678.      order.
  679.      *Note Directory Search for Link Libraries: Libraries/Search.
  680.  
  681. 
  682. File: make.info,  Node: Error Messages,  Next: Complex Makefile,  Prev: Quick Reference,  Up: Top
  683.  
  684. Errors Generated by Make
  685. ************************
  686.  
  687.    Here is a list of the more common errors you might see generated by
  688. `make', and some information about what they mean and how to fix them.
  689.  
  690.    Sometimes `make' errors are not fatal, especially in the presence of
  691. a `-' prefix on a command script line, or the `-k' command line option.
  692. Errors that are fatal are prefixed with the string `***'.
  693.  
  694.    Error messages are all either prefixed with the name of the program
  695. (usually `make'), or, if the error is found in a makefile, the name of
  696. the file and linenumber containing the problem.
  697.  
  698.    In the table below, these common prefixes are left off.
  699.  
  700. `[FOO] Error NN'
  701. `[FOO] SIGNAL DESCRIPTION'
  702.      These errors are not really `make' errors at all.  They mean that a
  703.      program that `make' invoked as part of a command script returned a
  704.      non-0 error code (`Error NN'), which `make' interprets as failure,
  705.      or it exited in some other abnormal fashion (with a signal of some
  706.      type).  *Note Errors in Commands: Errors.
  707.  
  708.      If no `***' is attached to the message, then the subprocess failed
  709.      but the rule in the makefile was prefixed with the `-' special
  710.      character, so `make' ignored the error.
  711.  
  712. `missing separator.  Stop.'
  713. `missing separator (did you mean TAB instead of 8 spaces?).  Stop.'
  714.      This means that `make' could not understand much of anything about
  715.      the command line it just read.  GNU `make' looks for various kinds
  716.      of separators (`:', `=', TAB characters, etc.) to help it decide
  717.      what kind of commandline it's seeing.  This means it couldn't find
  718.      a valid one.
  719.  
  720.      One of the most common reasons for this message is that you (or
  721.      perhaps your oh-so-helpful editor, as is the case with many
  722.      MS-Windows editors) have attempted to indent your command scripts
  723.      with spaces instead of a TAB character.  In this case, `make' will
  724.      use the second form of the error above.  Remember that every line
  725.      in the command script must begin with a TAB character.  Eight
  726.      spaces do not count.  *Note Rule Syntax::.
  727.  
  728. `commands commence before first target.  Stop.'
  729. `missing rule before commands.  Stop.'
  730.      This means the first thing in the makefile seems to be part of a
  731.      command script: it begins with a TAB character and doesn't appear
  732.      to be a legal `make' command (such as a variable assignment).
  733.      Command scripts must always be associated with a target.
  734.  
  735.      The second form is generated if the line has a semicolon as the
  736.      first non-whitespace character; `make' interprets this to mean you
  737.      left out the "target: prerequisite" section of a rule.  *Note Rule
  738.      Syntax::.
  739.  
  740. `No rule to make target `XXX'.'
  741. `No rule to make target `XXX', needed by `YYY'.'
  742.      This means that `make' decided it needed to build a target, but
  743.      then couldn't find any instructions in the makefile on how to do
  744.      that, either explicit or implicit (including in the default rules
  745.      database).
  746.  
  747.      If you want that file to be built, you will need to add a rule to
  748.      your makefile describing how that target can be built.  Other
  749.      possible sources of this problem are typos in the makefile (if
  750.      that filename is wrong) or a corrupted source tree (if that file
  751.      is not supposed to be built, but rather only a prerequisite).
  752.  
  753. `No targets specified and no makefile found.  Stop.'
  754. `No targets.  Stop.'
  755.      The former means that you didn't provide any targets to be built
  756.      on the command line, and `make' couldn't find any makefiles to
  757.      read in.  The latter means that some makefile was found, but it
  758.      didn't contain any default target and none was given on the
  759.      command line.  GNU `make' has nothing to do in these situations.
  760.      *Note Arguments to Specify the Makefile: Makefile Arguments.
  761.  
  762. `Makefile `XXX' was not found.'
  763. `Included makefile `XXX' was not found.'
  764.      A makefile specified on the command line (first form) or included
  765.      (second form) was not found.
  766.  
  767. `warning: overriding commands for target `XXX''
  768. `warning: ignoring old commands for target `XXX''
  769.      GNU `make' allows commands to be specified only once per target
  770.      (except for double-colon rules).  If you give commands for a target
  771.      which already has been defined to have commands, this warning is
  772.      issued and the second set of commands will overwrite the first set.
  773.      *Note Multiple Rules for One Target: Multiple Rules.
  774.  
  775. `Circular XXX <- YYY dependency dropped.'
  776.      This means that `make' detected a loop in the dependency graph:
  777.      after tracing the prerequisite YYY of target XXX, and its
  778.      prerequisites, etc., one of them depended on XXX again.
  779.  
  780. `Recursive variable `XXX' references itself (eventually).  Stop.'
  781.      This means you've defined a normal (recursive) `make' variable XXX
  782.      that, when it's expanded, will refer to itself (XXX).  This is not
  783.      allowed; either use simply-expanded variables (`:=') or use the
  784.      append operator (`+=').  *Note How to Use Variables: Using
  785.      Variables.
  786.  
  787. `Unterminated variable reference.  Stop.'
  788.      This means you forgot to provide the proper closing parenthesis or
  789.      brace in your variable or function reference.
  790.  
  791. `insufficient arguments to function `XXX'.  Stop.'
  792.      This means you haven't provided the requisite number of arguments
  793.      for this function.  See the documentation of the function for a
  794.      description of its arguments.  *Note Functions for Transforming
  795.      Text: Functions.
  796.  
  797. `missing target pattern.  Stop.'
  798. `multiple target patterns.  Stop.'
  799. `target pattern contains no `%'.  Stop.'
  800.      These are generated for malformed static pattern rules.  The first
  801.      means there's no pattern in the target section of the rule, the
  802.      second means there are multiple patterns in the target section,
  803.      and the third means the target doesn't contain a pattern character
  804.      (`%').  *Note Syntax of Static Pattern Rules: Static Usage.
  805.  
  806. `warning: -jN forced in submake: disabling jobserver mode.'
  807.      This warning and the next are generated if `make' detects error
  808.      conditions related to parallel processing on systems where
  809.      sub-`make's can communicate (*note Communicating Options to a
  810.      Sub-`make': Options/Recursion.).  This warning is generated if a
  811.      recursive invocation of a `make' process is forced to have `-jN'
  812.      in its argument list (where N is greater than one).  This could
  813.      happen, for example, if you set the `MAKE' environment variable to
  814.      `make -j2'.  In this case, the sub-`make' doesn't communicate with
  815.      other `make' processes and will simply pretend it has two jobs of
  816.      its own.
  817.  
  818. `warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.'
  819.      In order for `make' processes to communicate, the parent will pass
  820.      information to the child.  Since this could result in problems if
  821.      the child process isn't actually a `make', the parent will only do
  822.      this if it thinks the child is a `make'.  The parent uses the
  823.      normal algorithms to determine this (*note How the `MAKE' Variable
  824.      Works: MAKE Variable.).  If the makefile is constructed such that
  825.      the parent doesn't know the child is a `make' process, then the
  826.      child will receive only part of the information necessary.  In
  827.      this case, the child will generate this warning message and
  828.      proceed with its build in a sequential manner.
  829.  
  830. 
  831. File: make.info,  Node: Complex Makefile,  Next: Concept Index,  Prev: Error Messages,  Up: Top
  832.  
  833. Complex Makefile Example
  834. ************************
  835.  
  836.    Here is the makefile for the GNU `tar' program.  This is a
  837. moderately complex makefile.
  838.  
  839.    Because it is the first target, the default goal is `all'.  An
  840. interesting feature of this makefile is that `testpad.h' is a source
  841. file automatically created by the `testpad' program, itself compiled
  842. from `testpad.c'.
  843.  
  844.    If you type `make' or `make all', then `make' creates the `tar'
  845. executable, the `rmt' daemon that provides remote tape access, and the
  846. `tar.info' Info file.
  847.  
  848.    If you type `make install', then `make' not only creates `tar',
  849. `rmt', and `tar.info', but also installs them.
  850.  
  851.    If you type `make clean', then `make' removes the `.o' files, and
  852. the `tar', `rmt', `testpad', `testpad.h', and `core' files.
  853.  
  854.    If you type `make distclean', then `make' not only removes the same
  855. files as does `make clean' but also the `TAGS', `Makefile', and
  856. `config.status' files.  (Although it is not evident, this makefile (and
  857. `config.status') is generated by the user with the `configure' program,
  858. which is provided in the `tar' distribution, but is not shown here.)
  859.  
  860.    If you type `make realclean', then `make' removes the same files as
  861. does `make distclean' and also removes the Info files generated from
  862. `tar.texinfo'.
  863.  
  864.    In addition, there are targets `shar' and `dist' that create
  865. distribution kits.
  866.  
  867.      # Generated automatically from Makefile.in by configure.
  868.      # Un*x Makefile for GNU tar program.
  869.      # Copyright (C) 1991 Free Software Foundation, Inc.
  870.      
  871.      # This program is free software; you can redistribute
  872.      # it and/or modify it under the terms of the GNU
  873.      # General Public License ...
  874.      ...
  875.      ...
  876.      
  877.      SHELL = /bin/sh
  878.      
  879.      #### Start of system configuration section. ####
  880.      
  881.      srcdir = .
  882.      
  883.      # If you use gcc, you should either run the
  884.      # fixincludes script that comes with it or else use
  885.      # gcc with the -traditional option.  Otherwise ioctl
  886.      # calls will be compiled incorrectly on some systems.
  887.      CC = gcc -O
  888.      YACC = bison -y
  889.      INSTALL = /usr/local/bin/install -c
  890.      INSTALLDATA = /usr/local/bin/install -c -m 644
  891.      
  892.      # Things you might add to DEFS:
  893.      # -DSTDC_HEADERS        If you have ANSI C headers and
  894.      #                       libraries.
  895.      # -DPOSIX               If you have POSIX.1 headers and
  896.      #                       libraries.
  897.      # -DBSD42               If you have sys/dir.h (unless
  898.      #                       you use -DPOSIX), sys/file.h,
  899.      #                       and st_blocks in `struct stat'.
  900.      # -DUSG                 If you have System V/ANSI C
  901.      #                       string and memory functions
  902.      #                       and headers, sys/sysmacros.h,
  903.      #                       fcntl.h, getcwd, no valloc,
  904.      #                       and ndir.h (unless
  905.      #                       you use -DDIRENT).
  906.      # -DNO_MEMORY_H         If USG or STDC_HEADERS but do not
  907.      #                       include memory.h.
  908.      # -DDIRENT              If USG and you have dirent.h
  909.      #                       instead of ndir.h.
  910.      # -DSIGTYPE=int         If your signal handlers
  911.      #                       return int, not void.
  912.      # -DNO_MTIO             If you lack sys/mtio.h
  913.      #                       (magtape ioctls).
  914.      # -DNO_REMOTE           If you do not have a remote shell
  915.      #                       or rexec.
  916.      # -DUSE_REXEC           To use rexec for remote tape
  917.      #                       operations instead of
  918.      #                       forking rsh or remsh.
  919.      # -DVPRINTF_MISSING     If you lack vprintf function
  920.      #                       (but have _doprnt).
  921.      # -DDOPRNT_MISSING      If you lack _doprnt function.
  922.      #                       Also need to define
  923.      #                       -DVPRINTF_MISSING.
  924.      # -DFTIME_MISSING       If you lack ftime system call.
  925.      # -DSTRSTR_MISSING      If you lack strstr function.
  926.      # -DVALLOC_MISSING      If you lack valloc function.
  927.      # -DMKDIR_MISSING       If you lack mkdir and
  928.      #                       rmdir system calls.
  929.      # -DRENAME_MISSING      If you lack rename system call.
  930.      # -DFTRUNCATE_MISSING   If you lack ftruncate
  931.      #                       system call.
  932.      # -DV7                  On Version 7 Unix (not
  933.      #                       tested in a long time).
  934.      # -DEMUL_OPEN3          If you lack a 3-argument version
  935.      #                       of open, and want to emulate it
  936.      #                       with system calls you do have.
  937.      # -DNO_OPEN3            If you lack the 3-argument open
  938.      #                       and want to disable the tar -k
  939.      #                       option instead of emulating open.
  940.      # -DXENIX               If you have sys/inode.h
  941.      #                       and need it 94 to be included.
  942.      
  943.      DEFS =  -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
  944.              -DVPRINTF_MISSING -DBSD42
  945.      # Set this to rtapelib.o unless you defined NO_REMOTE,
  946.      # in which case make it empty.
  947.      RTAPELIB = rtapelib.o
  948.      LIBS =
  949.      DEF_AR_FILE = /dev/rmt8
  950.      DEFBLOCKING = 20
  951.      
  952.      CDEBUG = -g
  953.      CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
  954.              -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
  955.              -DDEFBLOCKING=$(DEFBLOCKING)
  956.      LDFLAGS = -g
  957.      
  958.      prefix = /usr/local
  959.      # Prefix for each installed program,
  960.      # normally empty or `g'.
  961.      binprefix =
  962.      
  963.      # The directory to install tar in.
  964.      bindir = $(prefix)/bin
  965.      
  966.      # The directory to install the info files in.
  967.      infodir = $(prefix)/info
  968.      
  969.      #### End of system configuration section. ####
  970.      
  971.      SRC1 =  tar.c create.c extract.c buffer.c \
  972.              getoldopt.c update.c gnu.c mangle.c
  973.      SRC2 =  version.c list.c names.c diffarch.c \
  974.              port.c wildmat.c getopt.c
  975.      SRC3 =  getopt1.c regex.c getdate.y
  976.      SRCS =  $(SRC1) $(SRC2) $(SRC3)
  977.      OBJ1 =  tar.o create.o extract.o buffer.o \
  978.              getoldopt.o update.o gnu.o mangle.o
  979.      OBJ2 =  version.o list.o names.o diffarch.o \
  980.              port.o wildmat.o getopt.o
  981.      OBJ3 =  getopt1.o regex.o getdate.o $(RTAPELIB)
  982.      OBJS =  $(OBJ1) $(OBJ2) $(OBJ3)
  983.      AUX =   README COPYING ChangeLog Makefile.in  \
  984.              makefile.pc configure configure.in \
  985.              tar.texinfo tar.info* texinfo.tex \
  986.              tar.h port.h open3.h getopt.h regex.h \
  987.              rmt.h rmt.c rtapelib.c alloca.c \
  988.              msd_dir.h msd_dir.c tcexparg.c \
  989.              level-0 level-1 backup-specs testpad.c
  990.      
  991.      all:    tar rmt tar.info
  992.      
  993.      tar:    $(OBJS)
  994.              $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  995.      
  996.      rmt:    rmt.c
  997.              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
  998.      
  999.      tar.info: tar.texinfo
  1000.              makeinfo tar.texinfo
  1001.      
  1002.      install: all
  1003.              $(INSTALL) tar $(bindir)/$(binprefix)tar
  1004.              -test ! -f rmt || $(INSTALL) rmt /etc/rmt
  1005.              $(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
  1006.      
  1007.      $(OBJS): tar.h port.h testpad.h
  1008.      regex.o buffer.o tar.o: regex.h
  1009.      # getdate.y has 8 shift/reduce conflicts.
  1010.      
  1011.      testpad.h: testpad
  1012.              ./testpad
  1013.      
  1014.      testpad: testpad.o
  1015.              $(CC) -o $@ testpad.o
  1016.      
  1017.      TAGS:   $(SRCS)
  1018.              etags $(SRCS)
  1019.      
  1020.      clean:
  1021.              rm -f *.o tar rmt testpad testpad.h core
  1022.      
  1023.      distclean: clean
  1024.              rm -f TAGS Makefile config.status
  1025.      
  1026.      realclean: distclean
  1027.              rm -f tar.info*
  1028.      
  1029.      shar: $(SRCS) $(AUX)
  1030.              shar $(SRCS) $(AUX) | compress \
  1031.                > tar-`sed -e '/version_string/!d' \
  1032.                           -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  1033.                           -e q
  1034.                           version.c`.shar.Z
  1035.      
  1036.      dist: $(SRCS) $(AUX)
  1037.              echo tar-`sed \
  1038.                   -e '/version_string/!d' \
  1039.                   -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  1040.                   -e q
  1041.                   version.c` > .fname
  1042.              -rm -rf `cat .fname`
  1043.              mkdir `cat .fname`
  1044.              ln $(SRCS) $(AUX) `cat .fname`
  1045.              tar chZf `cat .fname`.tar.Z `cat .fname`
  1046.              -rm -rf `cat .fname` .fname
  1047.      
  1048.      tar.zoo: $(SRCS) $(AUX)
  1049.              -rm -rf tmp.dir
  1050.              -mkdir tmp.dir
  1051.              -rm tar.zoo
  1052.              for X in $(SRCS) $(AUX) ; do \
  1053.                  echo $$X ; \
  1054.                  sed 's/$$/^M/' $$X \
  1055.                  > tmp.dir/$$X ; done
  1056.              cd tmp.dir ; zoo aM ../tar.zoo *
  1057.              -rm -rf tmp.dir
  1058.  
  1059.